package com.example.drop.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.drop.R
import com.example.drop.entity.PointEntityItem

class PointAdapter :BaseQuickAdapter<PointEntityItem,BaseViewHolder>(R.layout.item_point) {
    override fun convert(holder: BaseViewHolder, item: PointEntityItem) {
        holder.setText(R.id.pointLocation,"点位位置: "+item.pointLocation)
        holder.setText(R.id.projectId,"所属项目: "+item.projectId)
        holder.setText(R.id.pointName,"项目名称/"+item.pointName)
        val patrolType = holder.getView<TextView>(R.id.patrolType)
        if(item.patrolType=="保洁巡检"){
            patrolType.setBackgroundResource(R.drawable.bg_blue)
            patrolType.setText("保洁巡检")
        }else if(item.patrolType=="安防巡检"){
            patrolType.setBackgroundResource(R.drawable.bg_ju)
            patrolType.setText("安防巡检")
        }else if(item.patrolType=="日常巡检"){
            patrolType.setBackgroundResource(R.drawable.bg_zhizhi)
            patrolType.setText("日常巡检")
        }else{
            patrolType.setBackgroundResource(R.drawable.bg_red)
            patrolType.setText("家居巡检")
        }
    }
}